#include <cstdio>

using namespace std;

int main( )
{
    double s;
    int m,n;
    int i,j,ta,tb;
    int a[1001],b[1001];
    while (scanf("%d%d",&m,&n)!=EOF)
    {
      if ( m==-1&&n==-1) break;
      for (i=0;i<n;i++)
        scanf("%d%d",&a[i],&b[i]);
      for (i=0;i<n-1;i++)
        for (j=i+1;j<n;j++)
            if ((double(a[i])/double(b[i]))<(double(a[j])/double(b[j])))
            {
              ta=a[i];tb=b[i];
              a[i]=a[j];b[i]=b[j];
              a[j]=ta;b[j]=tb;
            }
      i=0;s=0;
      while (m>=b[i]&&i<n)
      {
        m=m-b[i];
        s=s+a[i];
        i++;
      }
      if (m>=0&&i<n)
        s=s+double(m)*double(a[i])/double(b[i]);
      printf("%.3lf\n",s);
    }
    return 0;
}
